package com.um.jdy.app.shop.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 商品推荐类型
 * @author renjunwei
 * @date 2020/9/19 09:37
 */
public enum GoodsRecommendType {

    CWBK("0","生物护齿"),
    XPDP("1","匠心护航"),
    NFYX("2","潮选优品");

    private String key;
    private String value;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    GoodsRecommendType(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getKey(String value){
        for (GoodsRecommendType item : GoodsRecommendType.values()) {
            if(item.getValue().equals(value)){
                return item.getKey();
            }
        }
        return "";
    }

    public static List toList(){
        List list = new ArrayList();
        for (GoodsRecommendType item : GoodsRecommendType.values()) {
           Map map = new HashMap();
           map.put(item.getValue(),item.getKey());
           list.add(map);
        }
        return list;
    }
}
